<!-- 填写结算信息 -->
<template>
	<view>
		<view class="p-3">
			<view>
				<bg-title class="mb-3">
					<text style="font-size: 30rpx;">项目结算信息</text>
				</bg-title>
				<view class="bt-block">
					<bg-cell2 label="项目编号" :value="obj.projectNo"></bg-cell2>
					<bg-cell2 label="项目名称" :value="obj.projectName"></bg-cell2>
					<bg-cell2 label="含税合同金额" :value="obj.contractAmount|showZero"></bg-cell2>
					<bg-cell2 label="税率" value="3%"></bg-cell2>
					<bg-cell2 label="税金" :value="taxAmount|showZero"></bg-cell2>
					<bg-cell2 label="劳务成本金额" :value="obj.laborCosts|showZero"></bg-cell2>
					<bg-cell2 label="材料成本金额" :value="obj.materialCosts|showZero"></bg-cell2>
					<bg-cell2 label="管理成本金额" :value="obj.managementCosts|showZero"></bg-cell2>
					<bg-cell2 label="保险成本金额" :value="obj.insuranceAmount|showZero"></bg-cell2>
					<bg-cell2 label="其他成本金额" :value="obj.otherCosts|showZero"></bg-cell2>
					<bg-cell2 :border="false" label="含税毛利金额" :value="obj.grossProfitAmount|showZero"></bg-cell2>
					
				</view>
			</view>
			<view class="mt-3">
				<bg-title class="mb-3">
					<text style="font-size: 30rpx;">项目收入明细</text>
				</bg-title>
				<view class="bt-block">
					<bg-cell2 label="含税已回款" :value="obj.taxInclusiveReceivedPayment|showZero"></bg-cell2>
					<bg-cell2 label="含税应收款" :value="obj.taxInclusiveReceivablePayment|showZero"></bg-cell2>
					<bg-cell2 label="已开票金额" :value="obj.invoicedAmount|showZero"></bg-cell2>
					<bg-cell2 :border="false" label="已开票未回款" :value="obj.invoiceUnpaidAmount|showZero"></bg-cell2>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {settlementProject, getSettleMentDetail} from "@/api/project.js"
	
	export default {
		onLoad(options){
			this.projectId = options.pid
			this.getData()
			uni.$on("refresh-settle", ()=>{
				this.getData()
			})
		},
		onNavigationBarButtonTap() {
			uni.navigateTo({
				url:"/pages/project/settlement/settlement?pid="+this.projectId
			})
		},
		data() {
			return {
				projectId:'',
				obj:{}
			}
		},
		computed:{
			taxAmount(){
				return (this.obj.contractAmount*0.03).toFixed(2)
			},
		},
		filters:{
			showZero(str){
				if(str==null||str==''||str==undefined){
					return "0"
				} else {
					return str
				}
			}
		},
		methods: {
			getData(){
				getSettleMentDetail(this.projectId).then(res=>{
					this.obj = res.data
				})
			},
		}
	}
</script>

<style>

</style>
